﻿using Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using IRepository;

namespace ConcreteService
{
    public class CompanyService : CommonService
    {
        public  Company GetCompany(string code)
        {
            CompanyService service = ServiceFactory.CreateInstance<CompanyService>();
            UserInfoService userservice = ServiceFactory.CreateInstance<UserInfoService>();
            var obj=service.Get<Company>(code);
            if (obj != null)
            {
                obj.Type = AppConfig.GetBaseData(obj.TypeNO).Description;
                obj.JobType = AppConfig.GetBaseData(obj.JobTypeNO).Description;
                obj.Size = AppConfig.GetBaseData(obj.SizeNO).Description;
                obj.UserInfo = userservice.Get<UserInfo>(obj.CompanyNO.ToString());
            }
            return obj;
        }
    }
}
